package updatepackage;

import javabean.Schedule;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Updatesch extends Update{
    public void updateDB(Schedule sch){
        Connection conn = null;
        PreparedStatement pstmt = null;
        
        try {
            conn = getConnection();
            
            pstmt = conn.prepareStatement(
              "update SCHEDULE set schNAME=?,schDATE=?,schTEXT=? "+
              "where schNO=?");
            pstmt.setString(1, sch.getSchNAME());
            pstmt.setString(2, sch.getSchDATE());
            pstmt.setString(3, sch.getSchTEXT());
            pstmt.setInt(4, sch.getSchNO());
            
            pstmt.executeUpdate();
        } catch(SQLException ex) {
            //throw new ScheduleManagerException("updateSchedule", ex);
        } finally {
            if (pstmt != null) try { pstmt.close(); } catch(SQLException ex) {}
            if (conn != null) try { conn.close(); } catch(SQLException ex) {}
        }
    }
}